<template>
  <div class="app-container">
    订单列表

    <el-table
      :data="this.list" stripe style="width: 100%">
      <el-table-column type="index" width="50" label="序号"/>
      <el-table-column prop="user_id" label="药品编号"/>
      <el-table-column prop="medicinal_id" label="药品名称"/>
      <el-table-column prop="nums" label="数量"/>
      <el-table-column prop="point" label="地址"/>
    </el-table>
    <!-- 分页 -->
    <el-pagination
      :current-page="current"
      :page-size="limit"
      :total="total"
      style="padding: 30px 0; text-align: center;"
      layout="total, prev, pager, next, jumper"
      @current-change="getList"
    />
  </div>
</template>
<script>
import order from '@/api/order'

export default {
  data() {
    return {
      current: 1, //当前页
      limit: 3, //每页显示记录数
      searchObj: {}, //条件封装对象
      list: [], //每页数据集合
      total: 0,//总记录数
    }
  },
  created() {
    this.getList(this.current)
  },
  methods: {
    getList(page = 1) {//添加当前页参数
      this.current = page
      order.getList(this.current)
        .then(response => {//接口返回数据
//返回集合list
          this.list = response.data.records
          console.log(this.list)
//总记录数
          this.total = response.data.total
        })//请求成功
        .catch(error => {//请求失败
          console.log(error)
        })
    }
  }
}
</script>
